<template>
  <div>
    <div class="type-list">
      <router-link tag="div" v-for="(item,index) in typelists" :key="index" :to="'/detailPage?id=' + item.novelId"
      class="typename">
        {{ item.typeName }}
      </router-link>
    </div>
  </div>
</template>

<script>
import { getTypeList } from "../../api/home.js";

export default {
  data() {
    return {
      typelist: null,
      typelists:[]
    };
  },
  created() {
    getTypeList().then((data) => {
      this.typelist = data.typelist;
      for (var j = 0; j < this.typelist.length; j++) {
        if (j < 3) {
          this.typelists.push(this.typelist[j]);
        }
      }
    });
  },
};
</script>

<style lang="scss" scoped>

</style>